<!DOCTYPE html>
<html lang=en>
<head>
    <meta charset="utf-8">
    
    <title>《Android开发艺术探索》Chap1_Activity生命周期和启动模式 | The Old Man and the Sea</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="description" content="注：此篇笔记只记录重难点，对于基础和详细内容请自行学习《Android开发艺术探索》  1.1 Activity的生命周期1.1.1 典型情况下的生命周期 onStart和onResume的区别是onStart可见，还没有出现在前台，无法和用户进行交互。onResume获取到焦点可以和用户交互。  当启动新Activity是透明主题时，旧Activity不会走onStop。  Activity切换">
<meta name="keywords" content="books,android">
<meta property="og:type" content="article">
<meta property="og:title" content="《Android开发艺术探索》Chap1_Activity生命周期和启动模式">
<meta property="og:url" content="http://yoursite.com/2017/03/07/android/books/《Android开发艺术探索》Chap1_Activity生命周期和启动模式/index.html">
<meta property="og:site_name" content="The Old Man and the Sea">
<meta property="og:description" content="注：此篇笔记只记录重难点，对于基础和详细内容请自行学习《Android开发艺术探索》  1.1 Activity的生命周期1.1.1 典型情况下的生命周期 onStart和onResume的区别是onStart可见，还没有出现在前台，无法和用户进行交互。onResume获取到焦点可以和用户交互。  当启动新Activity是透明主题时，旧Activity不会走onStop。  Activity切换">
<meta property="og:locale" content="en">
<meta property="og:updated_time" content="2017-08-09T10:15:52.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="《Android开发艺术探索》Chap1_Activity生命周期和启动模式">
<meta name="twitter:description" content="注：此篇笔记只记录重难点，对于基础和详细内容请自行学习《Android开发艺术探索》  1.1 Activity的生命周期1.1.1 典型情况下的生命周期 onStart和onResume的区别是onStart可见，还没有出现在前台，无法和用户进行交互。onResume获取到焦点可以和用户交互。  当启动新Activity是透明主题时，旧Activity不会走onStop。  Activity切换">
    

    
        <link rel="alternate" href="/" title="The Old Man and the Sea" type="application/atom+xml" />
    

    

    <link rel="stylesheet" href="/libs/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/libs/open-sans/styles.css">
    <link rel="stylesheet" href="/libs/source-code-pro/styles.css">

    <link rel="stylesheet" href="/css/style.css">

    <script src="/libs/jquery/2.1.3/jquery.min.js"></script>
    
    
        <link rel="stylesheet" href="/libs/lightgallery/css/lightgallery.min.css">
    
    
        <link rel="stylesheet" href="/libs/justified-gallery/justifiedGallery.min.css">
    
    
    
    


</head>

<body>
    <div id="container">
        <header id="header">
    <div id="header-main" class="header-inner">
        <div class="outer">
            <a href="/" id="logo">
                
                <span class="site-title">The Old Man and the Sea</span>
            </a>
            <nav id="main-nav">
                
                    <a class="main-nav-link" href="/.">Home</a>
                
                    <a class="main-nav-link" href="/archives">Archives</a>
                
                    <a class="main-nav-link" href="/categories">Categories</a>
                
                    <a class="main-nav-link" href="/tags">Tags</a>
                
                    <a class="main-nav-link" href="/about">About</a>
                
            </nav>
            
                
                <nav id="sub-nav">
                    <div class="profile" id="profile-nav">
                        <a id="profile-anchor" href="javascript:;">
                            <img class="avatar" src="/uploads/images/avert.png" />
                            <i class="fa fa-caret-down"></i>
                        </a>
                    </div>
                </nav>
            
            <div id="search-form-wrap">

    <form class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="Search" />
        <button type="submit" class="search-form-submit"></button>
    </form>
    <div class="ins-search">
    <div class="ins-search-mask"></div>
    <div class="ins-search-container">
        <div class="ins-input-wrapper">
            <input type="text" class="ins-search-input" placeholder="Type something..." />
            <span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
        </div>
        <div class="ins-section-wrapper">
            <div class="ins-section-container"></div>
        </div>
    </div>
</div>
<script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: 'Posts',
            PAGES: 'Pages',
            CATEGORIES: 'Categories',
            TAGS: 'Tags',
            UNTITLED: '(Untitled)',
        },
        ROOT_URL: '/',
        CONTENT_URL: '/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>
<script src="/js/insight.js"></script>

</div>
        </div>
    </div>
    <div id="main-nav-mobile" class="header-sub header-inner">
        <table class="menu outer">
            <tr>
                
                    <td><a class="main-nav-link" href="/.">Home</a></td>
                
                    <td><a class="main-nav-link" href="/archives">Archives</a></td>
                
                    <td><a class="main-nav-link" href="/categories">Categories</a></td>
                
                    <td><a class="main-nav-link" href="/tags">Tags</a></td>
                
                    <td><a class="main-nav-link" href="/about">About</a></td>
                
                <td>
                    
    <div class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="Search" />
    </div>

                </td>
            </tr>
        </table>
    </div>
</header>

        <div class="outer">
            
                

<aside id="profile">
    <div class="inner profile-inner">
        <div class="base-info profile-block">
            <img id="avatar" src="/uploads/images/avert.png" />
            <h2 id="name">Ernest Chang</h2>
            <h3 id="title">Developer</h3>
            <span id="location"><i class="fa fa-map-marker"></i>Hangzhou, China</span>
            <a id="follow" target="_blank" href="https://github.com/Ernestchang/">FOLLOW</a>
        </div>
        <div class="article-info profile-block">
            <div class="article-info-block">
                22
                <span>posts</span>
            </div>
            <div class="article-info-block">
                9
                <span>tags</span>
            </div>
        </div>
        
        <div class="profile-block social-links">
            <table>
                <tr>
                    
                    
                    <td>
                        <a href="https://github.com/Ernestchang/" target="_blank" title="github" class=tooltip>
                            <i class="fa fa-github"></i>
                        </a>
                    </td>
                    
                    <td>
                        <a href="/" target="_blank" title="twitter" class=tooltip>
                            <i class="fa fa-twitter"></i>
                        </a>
                    </td>
                    
                    <td>
                        <a href="/" target="_blank" title="facebook" class=tooltip>
                            <i class="fa fa-facebook"></i>
                        </a>
                    </td>
                    
                    <td>
                        <a href="/" target="_blank" title="dribbble" class=tooltip>
                            <i class="fa fa-dribbble"></i>
                        </a>
                    </td>
                    
                    <td>
                        <a href="/" target="_blank" title="rss" class=tooltip>
                            <i class="fa fa-rss"></i>
                        </a>
                    </td>
                    
                </tr>
            </table>
        </div>
        
    </div>
</aside>

            
            <section id="main"><article id="post-android/books/《Android开发艺术探索》Chap1_Activity生命周期和启动模式" class="article article-type-post" itemscope itemprop="blogPost">
    <div class="article-inner">
        
        
            <header class="article-header">
                
    
        <h1 class="article-title" itemprop="name">
            《Android开发艺术探索》Chap1_Activity生命周期和启动模式
        </h1>
    

                
                    <div class="article-meta">
                        
    <div class="article-date">
        <i class="fa fa-calendar"></i>
        <a href="/2017/03/07/android/books/《Android开发艺术探索》Chap1_Activity生命周期和启动模式/">
            <time datetime="2017-03-07T09:01:33.000Z" itemprop="datePublished">2017-03-07</time>
        </a>
    </div>


                        
    <div class="article-category">
    	<i class="fa fa-folder"></i>
        <a class="article-category-link" href="/categories/android/">android</a><i class="fa fa-angle-right"></i><a class="article-category-link" href="/categories/android/books/">books</a><i class="fa fa-angle-right"></i><a class="article-category-link" href="/categories/android/books/《Android开发艺术探索》/">《Android开发艺术探索》</a>
    </div>

                        
    <div class="article-tag">
        <i class="fa fa-tag"></i>
        <a class="tag-link" href="/tags/android/">android</a>, <a class="tag-link" href="/tags/books/">books</a>
    </div>

                    </div>
                
            </header>
        
        
        <div class="article-entry" itemprop="articleBody">
        
            
            <p>注：此篇笔记只记录重难点，对于基础和详细内容请自行学习《Android开发艺术探索》</p>
<hr>
<h2 id="1-1-Activity的生命周期"><a href="#1-1-Activity的生命周期" class="headerlink" title="1.1 Activity的生命周期"></a>1.1 Activity的生命周期</h2><h3 id="1-1-1-典型情况下的生命周期"><a href="#1-1-1-典型情况下的生命周期" class="headerlink" title="1.1.1 典型情况下的生命周期"></a>1.1.1 典型情况下的生命周期</h3><ul>
<li><p>onStart和onResume的区别是onStart可见，还没有出现在前台，无法和用户进行交互。onResume获取到焦点可以和用户交互。</p>
</li>
<li><p>当启动新Activity是透明主题时，旧Activity不会走onStop。</p>
</li>
<li><p>Activity切换时，旧Activity的onPause会先执行，然后才会启动新的Activity。</p>
</li>
</ul>
<h3 id="1-1-2-异常情况下的生命周期"><a href="#1-1-2-异常情况下的生命周期" class="headerlink" title="1.1.2 异常情况下的生命周期"></a>1.1.2 异常情况下的生命周期</h3><ul>
<li><p>Activity在异常情况下被回收时，onSaveInstanceState方法会被回调，回调时机是在onStop之前，当Activity被重新创建的时候，onRestoreInstanceState方法会被回调，时序在onStart之后；</p>
</li>
<li><p>当Activity异常情况下的情况下需要重新创建时，系统会默认我们保存当前Activity的视图结果，并在Activity重启后为我们恢复这些数据，比如文本框用户输入的数据，ListView的滚动位置等，具体可以查看相对应View的源码，查看onSaveInstanceState和onRestoreInstanceState方法。</p>
</li>
<li><p>关于保存和恢复View的层次结构，系统的<strong>工作流程</strong>：首先Activity会调用onSaveInstanceState去保存数据，然后Activity会<strong>委托</strong>Window去保存数据，接着Window会委托它上面的顶级容器去保存数据，顶层容器一般是DecorView（ViewGroup)；最后顶层容器再去一一通知它的子元素保存数据，这样整个数据的保存过程就完成了。</p>
</li>
<li>如果资源内存不足优先级低的Activity会被杀死，<strong>优先级</strong>从高到低：</li>
<li>前台Activity-正在和用户交互优先级最高；</li>
<li>可见但非前台的Activity-比如Activity中弹了一个对话框，导致Activty可见但位于后台；</li>
<li><p>后台Activity-已经被暂停的Activity，已经执行了onStop，优先级最低。</p>
</li>
<li><p>如果我们不想配置发生改变就Activity重新创建，可以使用Activity的<strong>configChanges</strong>属性；常用的有locale、orientation和keyboardHidden这三个选项；指定了configChanges后，Activity发生对应改变后，不会重启Activity，只会调用onConfigurationChanged方法。</p>
</li>
</ul>
<h2 id="1-2-Activity的启动模式"><a href="#1-2-Activity的启动模式" class="headerlink" title="1.2 Activity的启动模式"></a>1.2 Activity的启动模式</h2><h3 id="1-2-1-Activity的LaunchMode"><a href="#1-2-1-Activity的LaunchMode" class="headerlink" title="1.2.1 Activity的LaunchMode"></a>1.2.1 Activity的LaunchMode</h3><p><strong>任务栈</strong>是一个“后进先出”的栈结构，每次finish()处于前台的Activity就会出栈，直到栈为空为止，当栈中无任何Activity的时候，系统就会回收这个任务栈。</p>
<ul>
<li><p><strong>standard</strong>：标准模式，系统默认模式，每次启动都会创建一个新的实例；在这种模式下，谁启动了这个Activity，这个Activity就在启动它的那个Activity所在的栈中。当我们使用ApplicationContext去启动standard模式的Activity就会报错，因为standard模式的Activity会默认进入启动它的Activity所属的任务栈中，而非Activity类型的Context并没有任务栈。解决的办法是为这个待启动的Activity指定FLAG_ACTIVITY_NEW_TASK标记位，这样启动的时候就会为它创建一个新的任务栈。</p>
</li>
<li><p><strong>singleTop</strong>: 栈顶复用模式。这种模式下，如果新的Activity已经位于栈顶，那么此Activity不会创建，同时他的onNewIntent方法会被回调，onCreate、onStart不会被调用。如果新的Activity的实例存在但不是位于栈顶，那么新的Activty依然会重新创建。</p>
</li>
<li><p><strong>singleTask</strong>: 栈内复用模式。这是一种单实例模式，这种模式下，Activity在一个栈中存在，那么多次启动该Activity都不会重新创建实例，和sinleTop一样，系统会回调其onNewIntent。如果启动的Activity没有所需要的任务栈，就会先创建任务栈再创建Activity。singleTask默认具有clearTop的效果，具有该模式的Activity会让其之上的Activity全部出栈。</p>
</li>
<li><p><strong>singleInstance</strong>: 单实例模式。这是一种加强的singleTask模式，除了具备singleTask的特性之外，具有该模式的Activity只能单独位于一个任务栈中；比如Activity A是singleInstance模式的，当A启动后，系统会为它创建一个新的任务栈，后续的启动均不会创建新的Activity，除非这个任务栈被系统销毁了。</p>
</li>
<li><p>参数TaskAffinity用于指定Activity栈，TaskAffinity属性经常和singleTask启动模式或allowTaskReparenting属性配对使用，其他情况没有意义。当应用A启动了应用B的某个Activity后，如果这个Activity的allowTaskReparenting属性为true的话，那么当应用B被启动后，此Activity会直接从应用A的任务栈转移到应用B的任务栈中。</p>
</li>
<li><p>两种方法都可以为Activity指定启动模式，但还是有区别。</p>
</li>
<li><p>Activity的启动模式可以通过AndroidMenifest为其指定启动模式</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">&lt;activity android:name=&quot;.MainActivity&quot; android:launchMode=&quot;singleTask&quot; /&gt;</div></pre></td></tr></table></figure>
</li>
<li><p>还可以通过在Intent中设置标记位来为Activity指定启动模式</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">Intent intent = new Intent(this,MainActivity.class); </div><div class="line">intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);</div><div class="line"> startActivity(intent);</div></pre></td></tr></table></figure>
</li>
<li><p>第二种方式的<strong>优先级</strong>高于第一种，如果都设置了只有第二种会生效。第一种方式无法直接为Activity设置FLAG_ACTIVITY_CLEAR_TOP标记，而第二种方式无法为Activity指定singleInstance模式。</p>
</li>
<li><p>通过adb shell dumpsys activity命令可以详细的了解当前任务栈情况。</p>
</li>
</ul>
<h3 id="1-2-2-Activity的Flags"><a href="#1-2-2-Activity的Flags" class="headerlink" title="1.2.2 Activity的Flags"></a>1.2.2 Activity的Flags</h3><ul>
<li><p>FLAG_ACTIVITY_NEW_TASK为Activity指定“singleTask”启动模式，其效果和xml中指定该启动模式相同。</p>
</li>
<li><p>FLAG_ACTIVITY_SINGLE_TOP为Activity指定“singleTop”启动模式，其效果和xml中指定该启动模式相同。</p>
</li>
<li><p>FLAG_ACTIVITY_CLEAR_TOP具有此标记位的Activity，当他启动时，在同一个任务栈中所有位于它上面的Activity都要出栈。这个模式一般与FLAG_ACTIVITY_NEW_TASK配合使用，singleTask启动模式默认具有此标记为的效果。</p>
</li>
<li><p>FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS具有这个标记为的Activity不会出现在历史Activity的列表中，当某些情况不希望用户通过历史列表回到我们Activity的时候这边标记比较有用。等同于在XML中指定Activity的属性android:excludeFromRecents=”true”。</p>
</li>
</ul>
<h2 id="1-3-IntentFilter的匹配规则"><a href="#1-3-IntentFilter的匹配规则" class="headerlink" title="1.3 IntentFilter的匹配规则"></a>1.3 IntentFilter的匹配规则</h2><p>启动Activity分为两种，显式调用（明确地指定被启动对象的组件信息，包括包名和类名）和隐式调用（不需要明确指定组件信息，需要Intent能匹配上目标组件的IntentFilter中所设置的过滤信息）。IntentFilter的过滤信息有action、category、data。为了匹配过滤列表，需同时匹配过滤列表中的action、category、data信息，否则匹配失败；一个Activity中可以有多个intent-filter，一个Intent只要能匹配任何一组intent-filter即可成功启动对应的Activity。</p>
<ul>
<li><p>action匹配规则：要求intent中的action存在且必须和过滤规则中的其中一个相同，区分大小写。</p>
</li>
<li><p>category匹配规则：系统会默认加上一个android.intent.category.DEAFAULT，所以intent中可以不存在category，但如果存在就必须匹配其中一个。同时为了我们的Activity能够支持隐式调用，就必须要在intent-filter中指定“android.intent.category.DEFAULT”这个category。</p>
</li>
<li><p>data匹配规则：data由两部分组成，mimeType和URI，要求和action相似。如果没有指定URI，URI但默认值为content和file（schema）</p>
</li>
<li><p>如果要为Intent指定完整的data，必须调用setDataAndType方法，不能先调用setData再调用setType，因为这两个方法都会清除对方的值。</p>
</li>
<li><p>采用PackageManager的resolveActivity方法或Intent的resolveActivity方法，如果找不到匹配的Activity就会返回null，我们通过判断返回值就可以规避抛出android.content.ActivityNotFoundException异常。</p>
</li>
<li><p>在intent-filter中声明了<category android:name="android.intent.category.DEFAULT">这个category的Activity，才可以接收隐式意图。</category></p>
</li>
<li><p>有一类action和category的共同作用是标明这是一个入口Activity。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">&lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;</div><div class="line">&lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;</div></pre></td></tr></table></figure></li>
</ul>

        
        </div>
        <footer class="article-footer">
            <div class="share-container">



</div>

    <a data-url="http://yoursite.com/2017/03/07/android/books/《Android开发艺术探索》Chap1_Activity生命周期和启动模式/" data-id="cj6oqpm0e000zyjpj380py0fr" class="article-share-link"><i class="fa fa-share"></i>Share</a>
<script>
    (function ($) {
        // Prevent duplicate binding
        if (typeof(__SHARE_BUTTON_BINDED__) === 'undefined' || !__SHARE_BUTTON_BINDED__) {
            __SHARE_BUTTON_BINDED__ = true;
        } else {
            return;
        }
        $('body').on('click', function() {
            $('.article-share-box.on').removeClass('on');
        }).on('click', '.article-share-link', function(e) {
            e.stopPropagation();

            var $this = $(this),
                url = $this.attr('data-url'),
                encodedUrl = encodeURIComponent(url),
                id = 'article-share-box-' + $this.attr('data-id'),
                offset = $this.offset(),
                box;

            if ($('#' + id).length) {
                box = $('#' + id);

                if (box.hasClass('on')){
                    box.removeClass('on');
                    return;
                }
            } else {
                var html = [
                    '<div id="' + id + '" class="article-share-box">',
                        '<input class="article-share-input" value="' + url + '">',
                        '<div class="article-share-links">',
                            '<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="fa fa-twitter article-share-twitter" target="_blank" title="Twitter"></a>',
                            '<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="fa fa-facebook article-share-facebook" target="_blank" title="Facebook"></a>',
                            '<a href="http://pinterest.com/pin/create/button/?url=' + encodedUrl + '" class="fa fa-pinterest article-share-pinterest" target="_blank" title="Pinterest"></a>',
                            '<a href="https://plus.google.com/share?url=' + encodedUrl + '" class="fa fa-google article-share-google" target="_blank" title="Google+"></a>',
                        '</div>',
                    '</div>'
                ].join('');

              box = $(html);

              $('body').append(box);
            }

            $('.article-share-box.on').hide();

            box.css({
                top: offset.top + 25,
                left: offset.left
            }).addClass('on');

        }).on('click', '.article-share-box', function (e) {
            e.stopPropagation();
        }).on('click', '.article-share-box-input', function () {
            $(this).select();
        }).on('click', '.article-share-box-link', function (e) {
            e.preventDefault();
            e.stopPropagation();

            window.open(this.href, 'article-share-box-window-' + Date.now(), 'width=500,height=450');
        });
    })(jQuery);
</script>

            
    
        <a href="http://yoursite.com/2017/03/07/android/books/《Android开发艺术探索》Chap1_Activity生命周期和启动模式/#comments" class="article-comment-link disqus-comment-count" data-disqus-url="http://yoursite.com/2017/03/07/android/books/《Android开发艺术探索》Chap1_Activity生命周期和启动模式/">Comments</a>
    

        </footer>
    </div>
    
        
<nav id="article-nav">
    
        <a href="/2017/03/07/android/books/《Android开发艺术探索》Chap2_IPC机制/" id="article-nav-newer" class="article-nav-link-wrap">
            <strong class="article-nav-caption">Newer</strong>
            <div class="article-nav-title">
                
                    《Android开发艺术探索》Chap2_IPC机制
                
            </div>
        </a>
    
    
        <a href="/2017/03/07/android/code/H5启动Android App/" id="article-nav-older" class="article-nav-link-wrap">
            <strong class="article-nav-caption">Older</strong>
            <div class="article-nav-title">H5启动Android App</div>
        </a>
    
</nav>


    
</article>


    
    
        <section id="comments">
    <div id="disqus_thread">
        <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    </div>
</section>
    

</section>
            
                
<aside id="sidebar">
   
        
    <div class="widget-wrap">
        <h3 class="widget-title">recent</h3>
        <div class="widget">
            <ul id="recent-post" class="">
                
                    <li>
                        
                        <div class="item-thumbnail">
                            <a href="/2017/08/23/predator/" class="thumbnail">
    
    
        <span class="thumbnail-image thumbnail-none"></span>
    
</a>

                        </div>
                        
                        <div class="item-inner">
                            <p class="item-category"></p>
                            <p class="item-title"><a href="/2017/08/23/predator/" class="title"></a></p>
                            <p class="item-date"><time datetime="2017-08-23T02:50:51.000Z" itemprop="datePublished">2017-08-23</time></p>
                        </div>
                    </li>
                
                    <li>
                        
                        <div class="item-thumbnail">
                            <a href="/2017/08/23/node/node_three_libraies/" class="thumbnail">
    
    
        <span class="thumbnail-image thumbnail-none"></span>
    
</a>

                        </div>
                        
                        <div class="item-inner">
                            <p class="item-category"></p>
                            <p class="item-title"><a href="/2017/08/23/node/node_three_libraies/" class="title"></a></p>
                            <p class="item-date"><time datetime="2017-08-23T02:16:21.000Z" itemprop="datePublished">2017-08-23</time></p>
                        </div>
                    </li>
                
                    <li>
                        
                        <div class="item-thumbnail">
                            <a href="/2017/08/22/mysql/mac导出:导入mysql/" class="thumbnail">
    
    
        <span class="thumbnail-image thumbnail-none"></span>
    
</a>

                        </div>
                        
                        <div class="item-inner">
                            <p class="item-category"><a class="article-category-link" href="/categories/mysql/">mysql</a></p>
                            <p class="item-title"><a href="/2017/08/22/mysql/mac导出:导入mysql/" class="title">mac导出/导入mysql</a></p>
                            <p class="item-date"><time datetime="2017-08-22T11:26:44.000Z" itemprop="datePublished">2017-08-22</time></p>
                        </div>
                    </li>
                
                    <li>
                        
                        <div class="item-thumbnail">
                            <a href="/2017/08/18/linux/vim的常用命令/" class="thumbnail">
    
    
        <span class="thumbnail-image thumbnail-none"></span>
    
</a>

                        </div>
                        
                        <div class="item-inner">
                            <p class="item-category"><a class="article-category-link" href="/categories/linux/">linux</a><i class="fa fa-angle-right"></i><a class="article-category-link" href="/categories/linux/vim/">vim</a></p>
                            <p class="item-title"><a href="/2017/08/18/linux/vim的常用命令/" class="title">vim的常用命令</a></p>
                            <p class="item-date"><time datetime="2017-08-18T06:59:13.000Z" itemprop="datePublished">2017-08-18</time></p>
                        </div>
                    </li>
                
                    <li>
                        
                        <div class="item-thumbnail">
                            <a href="/2017/07/19/git/git commit 编写风格模板/" class="thumbnail">
    
    
        <span class="thumbnail-image thumbnail-none"></span>
    
</a>

                        </div>
                        
                        <div class="item-inner">
                            <p class="item-category"><a class="article-category-link" href="/categories/git/">git</a></p>
                            <p class="item-title"><a href="/2017/07/19/git/git commit 编写风格模板/" class="title">git commit 编写风格模板</a></p>
                            <p class="item-date"><time datetime="2017-07-19T12:15:00.000Z" itemprop="datePublished">2017-07-19</time></p>
                        </div>
                    </li>
                
            </ul>
        </div>
    </div>

    
        
    <div class="widget-wrap">
        <h3 class="widget-title">categories</h3>
        <div class="widget">
            <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/android/">android</a><span class="category-list-count">7</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/android/books/">books</a><span class="category-list-count">3</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/android/books/《Android开发艺术探索》/">《Android开发艺术探索》</a><span class="category-list-count">3</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/android/code/">code</a><span class="category-list-count">4</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/git/">git</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/learn/">learn</a><span class="category-list-count">1</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/learn/books/">books</a><span class="category-list-count">1</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/learn/books/《如何高效学习》/">《如何高效学习》</a><span class="category-list-count">1</span></li></ul></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/linux/">linux</a><span class="category-list-count">1</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/linux/vim/">vim</a><span class="category-list-count">1</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/mysql/">mysql</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/node/">node</a><span class="category-list-count">1</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/node/books/">books</a><span class="category-list-count">1</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/node/books/7days/">7days</a><span class="category-list-count">1</span></li></ul></li></ul></li></ul>
        </div>
    </div>

    
        
    <div class="widget-wrap">
        <h3 class="widget-title">archives</h3>
        <div class="widget">
            <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/08/">August 2017</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/07/">July 2017</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/04/">April 2017</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/03/">March 2017</a><span class="archive-list-count">8</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">March 2016</a><span class="archive-list-count">7</span></li></ul>
        </div>
    </div>

    
        
    <div class="widget-wrap">
        <h3 class="widget-title">tags</h3>
        <div class="widget">
            <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/7days/">7days</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/android/">android</a><span class="tag-list-count">7</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/books/">books</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/code/">code</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/">git</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/learn/">learn</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mysql/">mysql</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/node/">node</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vim/">vim</a><span class="tag-list-count">1</span></li></ul>
        </div>
    </div>

    
        
    <div class="widget-wrap">
        <h3 class="widget-title">tag cloud</h3>
        <div class="widget tagcloud">
            <a href="/tags/7days/" style="font-size: 10px;">7days</a> <a href="/tags/android/" style="font-size: 20px;">android</a> <a href="/tags/books/" style="font-size: 16.67px;">books</a> <a href="/tags/code/" style="font-size: 13.33px;">code</a> <a href="/tags/git/" style="font-size: 10px;">git</a> <a href="/tags/learn/" style="font-size: 10px;">learn</a> <a href="/tags/mysql/" style="font-size: 10px;">mysql</a> <a href="/tags/node/" style="font-size: 10px;">node</a> <a href="/tags/vim/" style="font-size: 10px;">vim</a>
        </div>
    </div>

    
        
    <div class="widget-wrap widget-list">
        <h3 class="widget-title">links</h3>
        <div class="widget">
            <ul>
                
                    <li>
                        <a href="http://hexo.io">Hexo</a>
                    </li>
                
            </ul>
        </div>
    </div>


    
    <div id="toTop" class="fa fa-angle-up"></div>
</aside>

            
        </div>
        <footer id="footer">
    <div class="outer">
        <div id="footer-info" class="inner">
            &copy; 2017 Ernest Chang<br>
            Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>. Theme by <a href="http://github.com/ppoffice">PPOffice</a>
        </div>
    </div>
</footer>
        
    
    <script>
    var disqus_config = function () {
        
            this.page.url = 'http://yoursite.com/2017/03/07/android/books/《Android开发艺术探索》Chap1_Activity生命周期和启动模式/';
        
        this.page.identifier = 'android/books/《Android开发艺术探索》Chap1_Activity生命周期和启动模式';
    };
    (function() { 
        var d = document, s = d.createElement('script');  
        s.src = '//' + 'hexo-theme-icarus' + '.disqus.com/embed.js';
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
</script>




    
        <script src="/libs/lightgallery/js/lightgallery.min.js"></script>
        <script src="/libs/lightgallery/js/lg-thumbnail.min.js"></script>
        <script src="/libs/lightgallery/js/lg-pager.min.js"></script>
        <script src="/libs/lightgallery/js/lg-autoplay.min.js"></script>
        <script src="/libs/lightgallery/js/lg-fullscreen.min.js"></script>
        <script src="/libs/lightgallery/js/lg-zoom.min.js"></script>
        <script src="/libs/lightgallery/js/lg-hash.min.js"></script>
        <script src="/libs/lightgallery/js/lg-share.min.js"></script>
        <script src="/libs/lightgallery/js/lg-video.min.js"></script>
    
    
        <script src="/libs/justified-gallery/jquery.justifiedGallery.min.js"></script>
    
    



<!-- Custom Scripts -->
<script src="/js/main.js"></script>

    </div>
</body>
</html>